<template>
	<view>
		<goods-choose-list :priceType="2" :orderId="orderId" :details="details" height="100vh" @confirm="handleConfirm"></goods-choose-list>
	</view>
</template>

<script>
	import { commonStore } from "@/store/common.js"
	export default {
		setup() {
			const common = commonStore()
		
			return {
				common
			}
		},
		data() {
			return {
				orderId: 0,
				details: [],
			}
		},
		computed: {
			goodsDetails(){
				return this.common.goodsDetails
			}
		},
		onLoad(options) {
			this.orderId = options.orderId;
			// 从 Vuex 中读取 details
			this.details = this.goodsDetails;
		},
		methods: {
			setGoodsDetails(data) {
				this.common.goodsDetails = data
			},
			handleConfirm(confirmForm) {
				// 将 details 存储在 Vuex 中
				this.setGoodsDetails(confirmForm.details);
				uni.navigateBack()
			},
			handleCancel() {
				uni.navigateBack({
					delta: 1,
				});
			},
		}
	}
</script>

<style scoped>

</style>